package EjemplosEventosBasicos;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;


public class EjemploActionListener3 {
	
	public void montarVentana (){
		JFrame frame = new JFrame();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JButton boton = new JButton("Boton");
		boton.setActionCommand("Boton1");
		JButton boton2 = new JButton("Boton 2");
		boton2.setActionCommand("Boton2");
		
		
		EjemploActionListener4 eal4 = new EjemploActionListener4(boton, boton2);
		boton.addActionListener(eal4);
		boton2.addActionListener(eal4);
		
		/*boton.addActionListener(new EjemploActionListener4());
		boton2.addActionListener(new EjemploActionListener4());*/
		
		frame.add(boton, BorderLayout.NORTH);
		frame.add(boton2, BorderLayout.SOUTH);
		frame.setVisible(true);
		frame.pack();
	}
	
	public static void main (String[] args){
		EjemploActionListener3 eal = new EjemploActionListener3();
		eal.montarVentana();
	}
}
